package com.lhj.security.config.security;

import org.springframework.security.core.Authentication;

/**
 * @Description
 * @Author lhj
 * @Date 2024/12/27 10:32
 */
public class AuthenticationContextHolder {
    
    private static ThreadLocal<Authentication> contextHolder = new ThreadLocal<>();
    
    public static void setContextHolder(Authentication authentication) {
        contextHolder.set(authentication);
    }

    public static Authentication getContextHolder() {
        return contextHolder.get();
    }
    
    public static void clear() {
        contextHolder.remove();
    }
    
}
